//
//  MyViewController.m
//  UI_18_homework_SQLite_联系人信息存入数据库
//
//  Created by li cheng on 16/8/8.
//  Copyright © 2016年 li cheng. All rights reserved.
//

#import "MyViewController.h"
#import "TableViewCell.h"
@interface MyViewController ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) NSArray *array;
@property (nonatomic, strong) UITableView *tableView;
@end

@implementation MyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSString * DocumentsPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
    NSString *path = [DocumentsPath stringByAppendingPathComponent:@"images"];
    NSLog(@"++++++++++++++%@", path);
    self.navigationController.navigationBar.translucent = NO;
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) style:UITableViewStylePlain];
    [self.view addSubview:_tableView];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [_tableView registerClass:[TableViewCell class] forCellReuseIdentifier:@"TableViewCell"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _array.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TableViewCell" forIndexPath:indexPath];
    NSData *data = _array[indexPath.row];
    UIImage *iamge = [UIImage imageWithData:data];
    cell.myImageView.image = iamge;
    NSLog(@"照片的信息%@", iamge);
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 100;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
